using System;
using System.Collections.Generic;
using System.Text;
using Impact.Model.Service;
using Impact.Model.Objects;

namespace Impact.UnitTests.Mocks
{
    public class MockTagService : ITagService
    {

        public MockTagService()
        {
            tags = new List<Tag>();

            Tag one = new Tag();
            one.TagId = 1;
            one.Text = "one";
            tags.Add(one);

            Tag two = new Tag();
            two.TagId = 2;
            two.Text = "two";
            tags.Add(two);

            Tag three = new Tag();
            three.TagId = 3;
            three.Text = "three";
            tags.Add(three);

        }

        private List<Tag> tags;
        public List<Tag> Tags
        {
            get { return tags; }
        }


        #region ITagService Members

        public Tag FetchByID(int tagId)
        {
            return tags.Find(delegate(Tag tag)
            {
                return tag.TagId == tagId;
            });
        }

        public Tag FetchByText(string tagText)
        {
            return tags.Find(delegate(Tag tag)
            {
                return tag.Text.Equals(tagText);
            });
        }

        public ArticleTagCollection FetchArticleTags(int tagId)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public TagCollection FetchAll()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void Save(Tag t)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void Remove(int tagId)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion
    }
}
